//
//  MineViewController.m
//  lcf-newproject
//
//  Created by yangyang on 14-11-24.
//  Copyright (c) 2014年 yang. All rights reserved.
//

#import "MineViewController.h"
#import "PersonalCenterView.h"
#import "SettingManager.h"
#import "UIScrollView+extension.h"
#import "TradeRecordViewController.h"

typedef NS_ENUM (NSInteger,MineFunctionType){
    MineDealRecord = 0,
    MineTradeRecord,
    MineAccountRecharge,
    MineWithdraw,
    MineBankCard,
    MinefundCount,
    MineCreditManager,
    MineProjectNote,
    MineSettingManager,
    MineMessageNotification
};

@interface MineViewController ()

@end

@implementation MineViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = YES;
    //[UIStatusBarWindow ]
}

-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    self.navigationController.navigationBar.hidden = NO;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self uiConfig];
    // Do any additional setup after loading the view.
}

-(void)uiConfig{
    self.automaticallyAdjustsScrollViewInsets = NO;
    UIImageView * bgImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bj.png"]];
    bgImageView.frame = CGRectMake(0, 0, __MainScreen_Width, PersonalCenterHeight);
    [self.view addSubview:bgImageView];
    
    //创建自定义view
    PersonalCenterView * centerView = [[[NSBundle mainBundle]loadNibNamed:@"PersonalCenterView" owner:self options:nil]lastObject];
    centerView.frame = CGRectMake(0, 20, __MainScreen_Width, PersonalCenterHeight);
    
    //创建底部buttonView
    PersonalFunctionView * functionView = [[PersonalFunctionView alloc]initWithFrame:CGRectMake(0, centerView.frame.size.height+20, __MainScreen_Width, PersonalButtonHeight*4)];
    functionView.delegate =self;
    
    UIScrollView * scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, __MainScreen_Width, __MainScreen_Height)];
    scrollView.showsVerticalScrollIndicator = NO;
    scrollView.delegate = self;
    //scrollView.bounces = NO;
    scrollView.contentSize = CGSizeMake(__MainScreen_Width,centerView.frame.size.height+functionView.frame.size.height+__TabBar_Height);
    
    [self.view addSubview:scrollView];
    [scrollView addSubview:centerView];
    [scrollView addSubview:functionView];
}

#pragma mark - UIScrollViewDelegate

-(void)scrollViewDidScroll:(UIScrollView *)scrollView{
    //设置scrollView的上下偏移的界限 往下拉为正。
    [UIScrollView setScrollAreaWithScrollView:scrollView withFrontLocation:300 withBottomLocation:-200];
    
}


#pragma mark - PersonalFunctionViewDelegate
-(void)customTabBar:(PersonalFunctionView *)custom didSelectedIndex:(NSInteger)index{
    if(index == MineDealRecord){
    
    }else if (index == MineTradeRecord){
        TradeRecordViewController * tradeRecord = [[TradeRecordViewController alloc]init];
        [self.navigationController pushViewController:tradeRecord animated:YES];
    }else if (index == MineAccountRecharge){
        
    }
    else if (index == MineWithdraw){
        
    }
    else if (index == MineBankCard){
        
    }
    else if (index == MinefundCount){
        
    }
    else if (index == MineCreditManager){
        
    }
    else if (index == MineProjectNote){
        
    }
    else if (index == MineSettingManager){
        
    }
    else if (index == MineMessageNotification){
        
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}







@end
